<!--  -->
<template>
  <div class="collect">
     <h2>收藏</h2>
   <ul>
      <router-link  tag="li" :to="'/detail/' + getcollectdata.id"  v-for="getcollectdata in getcollectdatas.charts" :key="getcollectdata.id">
           <div class="img">
            <img :src="getcollectdata.face" />
          </div>
          <div class="w">
            <div class="title">{{getcollectdata.name}}</div>
            <div class="price">{{getcollectdata.lastText}}</div>
          </div>
          <div>
               <i class="iconfont icon-jiantou1"></i>
            </div>
         </router-link>
    </ul>
    <div class="loading" v-if="isLoading">
      <img src="@/assets/imange/loading.gif" alt>
      <span>玩命加载中...</span>
    </div>
    <div class="loading" v-else>
      <span>我也是有底线的</span>
    </div>
  </div>
</template>

<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
//例如：import 《组件名称》 from '《组件路径》';

export default {
  //import引入的组件需要注入到components对象中才能使用
  components: {},
  data() {
    //这里存放数据
    return {};
  },
  //计算属性 类似于data概念
  computed: {
    isLoading() {
     return this.$store.state.isLoading;
   },
    getcollectdatas(){
      return this.$store.state.collectDatas
    },
  },
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {},
  mounted() {
    this.$store.dispatch("actChangecollectDatas")
  },
};
</script>
<style lang="less">
.collect{
  h2{
            width: 100%;
            height: 4.4rem;
            line-height: 4.4rem;
            text-align: center;
            border-bottom: 2px solid #999;
  }
    ul {
    display: flex;
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
    li {
      width: 100%;
      margin-bottom: 1rem;
      background: #fff;
      border-radius: 1rem;
      display: flex;
      
      img {
        width: 9rem;
        height: 9rem;
        margin-top: 1rem;
        margin-left: 1rem;
        border-radius: 50%;    
         }
      .title {
        font-size: 2rem;
        width: 90%;
        // margin-left: 5%;
        height: 4rem;
        line-height: 4rem;
        font-weight: 700;

        // 多行文本出现省略号
      }
      .price {
        font-size: 1.4rem;
        text-align: left;
        // line-height: 4rem;
        margin-left: 2rem;

        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
      }
      .iconfont{
        font-size: 3rem;
        margin-left: 1rem;
        text-align: center;
        line-height: 10.3rem;
      }
    }
  }
  .loading {
    width: 100%;
    height: 5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 4.9rem;
    img {
      width: 3rem;
      height: 3rem;
    }
    span {
      font-size: 1.4rem;
      color: #999;
    }
  }
}
</style>